package com.googlecode.olabs.gui.client.rest;

import java.util.ArrayList;
import java.util.Collection;

public abstract class AbstractRestResource implements RestResource {

	private Collection<ResourceObserver> m_observers;

	public AbstractRestResource() {
		m_observers = new ArrayList<ResourceObserver>();
	}

	public final void addResourceObserver(ResourceObserver observer) {
		m_observers.add(observer);
	}

	public final void removeResourceObserver(ResourceObserver observer) {
		m_observers.remove(observer);
	}

	protected void notifyObservers() {
		for (ResourceObserver observer : m_observers) {
			observer.resourceChanged(this);
		}
	}
}
